{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "39cd0bcc",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 'abcde'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "1821136b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "c8bdd0d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "b = '这'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "074fd348",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "87298fa8",
   "metadata": {},
   "outputs": [],
   "source": [
    "c = 'zhe测试'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "af0c7bda",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(c)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "488b043a",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = r'E:\\pycharm_out\\yufa\\git_test'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e881ed61",
   "metadata": {},
   "outputs": [],
   "source": [
    "f = d.replace('E:','F:')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d480886a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'F:\\\\pycharm_out\\\\yufa\\\\git_test'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "06d3e44f",
   "metadata": {},
   "outputs": [],
   "source": [
    "g = d.replace('\\\\','/')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "b751e5f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'E:/pycharm_out/yufa/git_test'"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "514c4334",
   "metadata": {},
   "outputs": [],
   "source": [
    "a1 = \"h w\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "577352a8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a1.isspace()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "e0d785c2",
   "metadata": {},
   "outputs": [],
   "source": [
    "a2 = '  '"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "da985192",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a2.isspace()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "6d62cfb3",
   "metadata": {},
   "outputs": [],
   "source": [
    "b1 = a1.strip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "4eb7e3ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'h w'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "9952f4ea",
   "metadata": {},
   "outputs": [],
   "source": [
    "a3 =' ' + a1 + ' ' "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "3f4b7e1e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "' h w '"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "7cecb465",
   "metadata": {},
   "outputs": [],
   "source": [
    "b2 = a3.strip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "7ad90e3c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'h w'"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "4bb90ede",
   "metadata": {},
   "outputs": [],
   "source": [
    "b3 = a3.lstrip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "bdb94203",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'h w '"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "25dcb13e",
   "metadata": {},
   "outputs": [],
   "source": [
    "a4 = \"123456\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "6edec38e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a4.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "bd61a7fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "a5 = '123aaa'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "2ab5e4a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a5.isnumeric()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "b4e50216",
   "metadata": {},
   "outputs": [],
   "source": [
    "a6 = '123一二三'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "9a9d1acf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a6.isnumeric()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "a4b996f3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a6.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "05950c39",
   "metadata": {},
   "outputs": [],
   "source": [
    "f = 123456"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "0a96bd9b",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(r'E:\\vscode\\测试.txt', 'w' ,encoding='utf8') as w:\n",
    "    w.write(str(f))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "01195ec7",
   "metadata": {},
   "outputs": [],
   "source": [
    "g = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "51a73275",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(r'E:\\vscode\\测试.txt', 'r' ,encoding='utf8') as r:\n",
    "    g = r.read()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "bdd9c6fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'123456'"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "1171c9c6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g.isdigit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "83d90c19",
   "metadata": {},
   "outputs": [],
   "source": [
    "g1 = int(g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "857b536f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "123456"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "ad29e8b4",
   "metadata": {},
   "outputs": [],
   "source": [
    "aa1 = r'E:\\vscode\\ceshi.exr'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "d9e0b8b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E:\\vscode\\ceshi001.exr\n",
      "E:\\vscode\\ceshi002.exr\n",
      "E:\\vscode\\ceshi003.exr\n",
      "E:\\vscode\\ceshi004.exr\n",
      "E:\\vscode\\ceshi005.exr\n",
      "E:\\vscode\\ceshi006.exr\n",
      "E:\\vscode\\ceshi007.exr\n",
      "E:\\vscode\\ceshi008.exr\n",
      "E:\\vscode\\ceshi009.exr\n",
      "E:\\vscode\\ceshi010.exr\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,11):\n",
    "    aa2 = r'E:\\vscode\\ceshi%03d.exr' % i\n",
    "    print(aa2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "874509db",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E:\\vscode\\ceshi001.exr\n",
      "E:\\vscode\\ceshi002.exr\n",
      "E:\\vscode\\ceshi003.exr\n",
      "E:\\vscode\\ceshi004.exr\n",
      "E:\\vscode\\ceshi005.exr\n",
      "E:\\vscode\\ceshi006.exr\n",
      "E:\\vscode\\ceshi007.exr\n",
      "E:\\vscode\\ceshi008.exr\n",
      "E:\\vscode\\ceshi009.exr\n",
      "E:\\vscode\\ceshi010.exr\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,11):\n",
    "    aa2 = r'E:\\vscode\\ceshi{}.exr'.format(str(i).zfill(3))\n",
    "    print(aa2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a2037e24",
   "metadata": {},
   "outputs": [],
   "source": [
    "aa2 = r'E:\\vscode\\ceshi.exr'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "4a6bca3e",
   "metadata": {},
   "outputs": [],
   "source": [
    "aa3 = '10'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "b0a9a472",
   "metadata": {},
   "outputs": [],
   "source": [
    "aa4 = aa3.zfill(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "63906586",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'00010'"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aa4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "c792d55d",
   "metadata": {},
   "outputs": [],
   "source": [
    "bbb = 'aaabbbaaa'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "b9a3181a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bbb.startswith('aaab')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "08485f46",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bbb.endswith('baaa')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "8943b8c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "bbb1 = r'E:\\vscode\\ceshi.exr'  # r'D:\\ceshi.exr'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "6f722dc6",
   "metadata": {},
   "outputs": [],
   "source": [
    "bbb2 = []\n",
    "\n",
    "for i in range(1,11):\n",
    "    aa2 = r'E:\\vscode\\ceshi{}.exr'.format(str(i).zfill(3)) # r'D:\\ceshi.exr'\n",
    "    bbb2.append(aa2)\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "20389f55",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "D:\\ceshi005.exr\n"
     ]
    }
   ],
   "source": [
    "for i in bbb2:    #E:\\vscode\\ceshi010.exr\n",
    "    if i.endswith('005.exr'):\n",
    "        bbb3 = i.replace('E:\\\\vscode\\\\','D:\\\\')\n",
    "        print(bbb3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "id": "b09e01d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "ccc = [str(i) for i in range(5)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "id": "16b5ff8c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['0', '1', '2', '3', '4']"
      ]
     },
     "execution_count": 91,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ccc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "52fbb455",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddd = '_'.join(ccc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "id": "f2fb0b8d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'0_1_2_3_4'"
      ]
     },
     "execution_count": 93,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ddd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "id": "02634134",
   "metadata": {},
   "outputs": [],
   "source": [
    "ccc1 = [i for i in range(5)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "id": "b893919a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 95,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ccc1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "id": "17b46a34",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "sequence item 0: expected str instance, int found",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_10944/3946082605.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mddd2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'_'\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mccc1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: sequence item 0: expected str instance, int found"
     ]
    }
   ],
   "source": [
    "ddd2 = '_'.join(ccc1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "id": "2cda4201",
   "metadata": {},
   "outputs": [],
   "source": [
    "p = 'CXRX'\n",
    "eps = '10'\n",
    "pipline = 'rig'\n",
    "shot = '1-1-v001'\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "id": "ba1706c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddd3 = [p, eps, pipline, shot]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "0d3a7d3b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CXRX', '10', 'rig', '1-1-v001']"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ddd3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "04d24856",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddd4 = '_'.join(ddd3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "d42d2f52",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'CXRX_10_rig_1-1-v001'"
      ]
     },
     "execution_count": 101,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ddd4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "18be9f5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "ddd5 = ddd4.split('_')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "51a187bb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['CXRX', '10', 'rig', '1-1-v001']"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ddd5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5311d8c7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
